package com.xinggq.pay.service.controller;

import com.xinggq.common.CommonResult;
import com.xinggq.pay.service.service.AppCallbackService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Description
 * @Author xinggq
 * @Date 2025/9/18
 */
@Tag(name = "银盛支付")
@RestController()
@RequestMapping("/api/app/callback")
@Slf4j
@RequiredArgsConstructor
public class AppCallbackController {

  private final AppCallbackService appCallbackService;

  @Operation(summary = "重新推送回调，仅供运维使用")
  @GetMapping("/again")
  public CommonResult<Void> callBackAppAgain(
          @Parameter(description = "支付平台订单号")
          @RequestParam("tradeNo") String tradeNo) {
    appCallbackService.executeCallback(tradeNo);
    return CommonResult.ok();
  }

}
